﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */

#region Using
using System;
using System.Collections.Generic;
using System.Data.Common;
using NetBay.Core.Log;
using System.Data;
#endregion


namespace Rio.Framework.Business.Repository.Translator
{
    public class GUITranslator
    {

        /// <summary>
        /// Translate a bunch of User DataReader to Group object
        /// </summary>
        /// <param name="p_oIDataReader">The dataReader that contains the rows</param>
        /// <returns>A list of User Object</returns>
        public static Dictionary<long, string> TranslateIndexValueList(IDataReader p_oIDataReader)
        {
            var l_lstValues = new Dictionary<long, string>();

            try
            {
                using (p_oIDataReader)
                {
                    // Read all rows
                    while (p_oIDataReader.Read())
                    {
                        l_lstValues.Add(long.Parse(p_oIDataReader["ID"].ToString()),
                                        p_oIDataReader["VALUE"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.Instance().LogError(NetBay.Core.Diagnostics.Method.GetMethodBaseName(NetBay.Core.Diagnostics.Method.Level.Father) + " EXCEPTION -> " + Environment.NewLine + ex);
            }

            return l_lstValues;
        }


    }
}
